"""
携程首页POM,提供首页的火车，登录，注册等按钮
"""

from selenium.webdriver.common.by import By
from common.commontools import decorator
from common.basedriver import BaseDriver


class MainPage(BaseDriver):


    #找到登录空间
    @decorator()
    def main_login(self):
        return self.find_element(By.CSS_SELECTOR,"li#nav-bar-set-login span.member-name")

    #找到免费注册按钮
    @decorator()
    def main_register(self):
        return self.find_element(By.CSS_SELECTOR,"li#nav-bar-set-reg [class='set-text']")

    #找到导航页的火车
    @decorator()
    def main_train(self):
        return self.find_element(By.ID,"nav_trains")

    #找到国内火车票
    @decorator()
    def mian_train_inside(self):
        return self.find_element(By.ID,"c_ph_train_t")

    #找到国际/港台火车票
    @decorator()
    def main_train_outside(self):
        return self.find_element(By.ID,"c_ph_traino_t")

    #找到竖排的火车
    @decorator()
    def mian_train_vertical(self):
        return self.find_element(By.CSS_SELECTOR,"#searchBoxUl>li:nth-child(6)")


    #找到竖排的机票
    @decorator()
    def mian_flight_vertical(self):
        return self.find_element(By.CSS_SELECTOR,"#searchBoxUl>li:nth-child(2)")


